package com.nepxion.discovery.plugin.registercenter.kubernetes.configuration;

/**
 * <p>Title: Nepxion Discovery</p>
 * <p>Description: Nepxion Discovery</p>
 * <p>Copyright: Copyright (c) 2017-2050</p>
 * <p>Company: Nepxion</p>
 * @author cosmos
 * @version 1.0
 */

import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.nepxion.banner.BannerConstant;
import com.nepxion.banner.Description;
import com.nepxion.banner.LogoBanner;
import com.nepxion.banner.NepxionBanner;
import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter;
import com.nepxion.discovery.plugin.framework.configuration.PluginLoadBalanceConfiguration;
import com.nepxion.discovery.plugin.registercenter.kubernetes.adapter.KubernetesAdapter;
import com.nepxion.discovery.plugin.registercenter.kubernetes.constant.KubernetesConstant;
import com.taobao.text.Color;

@Configuration
@LoadBalancerClients(defaultConfiguration = { PluginLoadBalanceConfiguration.class })
public class KubernetesAutoConfiguration {
    static {
        LogoBanner logoBanner = new LogoBanner(KubernetesAutoConfiguration.class, "/com/nepxion/kubernetes/resource/logo.txt", "Welcome to Nepxion", 3, 5, new Color[] { Color.red, Color.green, Color.cyan }, true);

        NepxionBanner.show(logoBanner, new Description("Discovery:", KubernetesConstant.KUBERNETES_TYPE, 0, 1), new Description(BannerConstant.GITHUB + ":", BannerConstant.NEPXION_GITHUB + "/Discovery", 0, 1));
    }

    @Bean
    public PluginAdapter pluginAdapter() {
        return new KubernetesAdapter();
    }
}